package org.bunny.vehicle.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 用户
 * 
 * @author Bunny
 * @version 2013-5-16 下午4:01:42
 * 
 */
@Entity
public class User implements Serializable, Cloneable {

	private static final long serialVersionUID = -6245101984903805397L;

	/**
	 * 用户ID
	 */
	@Id
	@GeneratedValue
	private int id;

	/**
	 * 工号
	 */
	@Column(unique = true)
	private String number;

	/**
	 * 密码
	 */
	private String password;

	/**
	 * 类型
	 */
	private byte classification;

	/**
	 * 姓名
	 */
	private String name;

	/**
	 * 性别
	 */
	private byte sex;

	/**
	 * 入职日期
	 */
	@Temporal(TemporalType.DATE)
	private Date joinDate;

	/**
	 * 出生日期
	 */
	@Temporal(TemporalType.DATE)
	private Date birthday;

	/**
	 * 有效证件
	 */
	private String idCard;

	/**
	 * 电话
	 */
	private String phone;

	/**
	 * 用户类型-普通
	 */
	public static final byte CLASS_NORMAL = 0;

	/**
	 * 用户类型-司机
	 */
	public static final byte CLASS_DRIVER = 1;

	/**
	 * 用户类型-管理员
	 */
	public static final byte CLASS_ADMIN = 9;

	/**
	 * 性别-男
	 */
	public static final byte SEX_MALE = 0;

	/**
	 * 性别-女
	 */
	public static final byte SEX_FEMALE = 1;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof User)) {
			return false;
		}
		User other = (User) obj;
		if (id != other.id)
			return false;
		return true;
	}

	/**
	 * @return id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 *            要设置的 id
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return number
	 */
	public String getNumber() {
		return number;
	}

	/**
	 * @param number
	 *            要设置的 number
	 */
	public void setNumber(String number) {
		this.number = number;
	}

	/**
	 * @return password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            要设置的 password
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return classification
	 */
	public byte getClassification() {
		return classification;
	}

	/**
	 * @param classification
	 *            要设置的 classification
	 */
	public void setClassification(byte classification) {
		this.classification = classification;
	}

	/**
	 * @return name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            要设置的 name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return sex
	 */
	public byte getSex() {
		return sex;
	}

	/**
	 * @param sex
	 *            要设置的 sex
	 */
	public void setSex(byte sex) {
		this.sex = sex;
	}

	/**
	 * @return joinDate
	 */
	public Date getJoinDate() {
		return joinDate;
	}

	/**
	 * @param joinDate
	 *            要设置的 joinDate
	 */
	public void setJoinDate(Date joinDate) {
		this.joinDate = joinDate;
	}

	/**
	 * @return birthday
	 */
	public Date getBirthday() {
		return birthday;
	}

	/**
	 * @param birthday
	 *            要设置的 birthday
	 */
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	/**
	 * @return idCard
	 */
	public String getIdCard() {
		return idCard;
	}

	/**
	 * @param idCard
	 *            要设置的 idCard
	 */
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	/**
	 * @return phone
	 */
	public String getPhone() {
		return phone;
	}

	/**
	 * @param phone
	 *            要设置的 phone
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

}
